#ifndef _MANAGER_LIST_H_
#define _MANAGER_LIST_H_

typedef struct manager_list
{
    void *data;
    struct manager_list *next;
    struct manager_list *pre;
} manager_list_t;

/*
* Specific method of searching interface is realized by the user.
* meaning of return value:
*  0: query suceess
*  1: query fail
*/
typedef int (*query_element_callback)(manager_list_t *node, void *target);
/*
* meaning of return value:
*  0: query suceess
*  1: query fail
*/
typedef int (*del_element_callback)(manager_list_t *node, void *parament);

/*
* meaning of return value:
*  0: query suceess
*  1: query fail
*/
typedef int (*modify_element_callback)(manager_list_t *node, void *parament);

typedef int (*test_element_callback)(manager_list_t *node, void *parament);

void init_manager_list(manager_list_t *freq_list);
int count_manager_list(manager_list_t *freq_list);
int count_the_manager_list(manager_list_t *freq_list, void *target, query_element_callback cb);
void insert_head_manager_list(manager_list_t *freq_list, void *data);
void insert_tail_manager_list(manager_list_t *freq_list, void *data);
manager_list_t *get_head_list(manager_list_t *freq_list);

manager_list_t *query_head_list(manager_list_t *freq_list, void *target, query_element_callback cb);
int del_manager_node(manager_list_t *freq_list, void *parament, del_element_callback cb);
int remove_head_manager_node(manager_list_t *freq_list, void *parament);

int modify_manager_node(manager_list_t *freq_list, void *parament, modify_element_callback cb);
int remove_manager_node(manager_list_t *freq_list, void *parament, del_element_callback cb);
void clean_manager_list(manager_list_t *freq_list);
void test_head_list(manager_list_t *freq_list, void *target, test_element_callback cb);

#endif
